<template>
	<view>
		<text>离线数据数目：{{ count }}</text>
		<text style="margin-left: 60rpx;">已收到：{{ receivedData.length }}</text>
		<button @tap="onReadStoredDataButtonClick">读取存储数据</button>
		<view class="list">
			<view v-for="(listItem, listItemIndex) in receivedData" :key="listItemIndex" class="list-item">
				<text class="list-item__cell">序号：{{ listItemIndex + 1 }}</text>
				<text v-for="(item, index) in listItem" :key="index" class="list-item__cell">{{ index }}:
					{{ item }}</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			count: {
				type: Number,
				default: 0,
			},
			receivedData: {
				type: Array,
				default: () => [],
			},
		},
		methods: {
			onReadStoredDataButtonClick() {
				this.$emit('doread');
			},
		}
	};
</script>

<style>
	/* components/StoredDataDisplay/StoredDataDisplay.wxss */
	.list-item {
		display: flex;
		flex-wrap: wrap;
		padding: 20rpx 0;
		border-bottom: 1px solid #ddd;
	}

	.list-item__cell {
		width: 33.33%;
		padding: 10rpx 5rpx;
		box-sizing: border-box;
	}
</style>